﻿using System;
using Xms.Abp.Data;

namespace Xms.Abp.Features;

[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class FeatureValueAttribute : Attribute
{
    /// <summary>
    /// 默认值
    /// </summary>
    public string DefaultValue { get; set; }

    /// <summary>
    /// 是否对客户端可见
    /// </summary>
    public bool IsVisibleToClients { get; set; }
    public bool IsAvailableToHost { get; set; }
    public string[] AllowedProviders { get; }

    /// <summary>
    /// 自定义设置名称(默认：类名+属性名)
    /// </summary>
    public string CustomName { get; set; }

    /// <summary>
    /// 前端输入类型
    /// </summary>
    public DataType ValueType { get; set; }

    /// <summary>
    /// 设置定义构造函数
    /// </summary>
    /// <param name="defaultValue">默认值</param>
    /// <param name="isVisibleToClients">是否对客户端可见</param>
    /// <param name="customName">自定义设置名称(默认：类名+属性名)</param>
    /// <param name="valueType">前端输入类型</param>
    public FeatureValueAttribute(
        string defaultValue = null,
        bool isVisibleToClients = false,
        string customName = null,
        DataType valueType = DataType.Text)
    {
        DefaultValue = defaultValue;
        IsVisibleToClients = isVisibleToClients;
        CustomName = customName;
        ValueType = valueType;
    }
}
